package com.zekdot.pkcs3.action;

import com.zekdot.pkcs3.tool.PrimeTool;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import javax.servlet.http.HttpServletRequest;

/**
 * Create by zekdot on 18-12-26.
 */
@Controller
@RequestMapping("/")
public class Action {
    /**跳转到发起者主页
     *
     * @return
     */
    @RequestMapping("/host")
    public ModelAndView getHostPage(HttpServletRequest request){
        ModelAndView modelAndView=new ModelAndView("host");
        String prime=PrimeTool.getSafePrime();
        modelAndView.addObject("prime", prime);
        System.out.println("ip is "+request.getRemoteHost()+" num is "+prime);
        return modelAndView;
    }
    @RequestMapping("/guest")
    public ModelAndView getGuestPage(){
        ModelAndView modelAndView=new ModelAndView("guest");
        return modelAndView;
    }

}
